package com.chenliwu.demo.java8.stream;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * StringJoinDemo
 *
 * @author chenliwu
 * @since 2022-06-13
 */
public class StringJoinDemo {

    public static void main(String[] args) {
        testJoin();
    }

    private static void testJoin() {
        List<String> stringList = Arrays.asList("1", "2", "3", "4", "5", "6");

        System.out.println(stringList.stream().collect(Collectors.joining(",")));
        System.out.println(String.join(",", stringList));
    }

}
